import Axios from '.'

// 定义接口的传参
// interface UserInfoParam {
//   userID: string
//   userName: string
// }

// 获取用户信息
export function getUserInfo() {
  return Axios({
    url: '/getUserInfo',
    method: 'get',
  })
}

// 获取图书分类
export function getCategory() {
  return Axios({
    url: '/category',
    method: 'get',
  })
}

export function getHotBooks() {
  return Axios({
    url: '/getHotBook',
    method: 'get',
  })
}

export function getNewBooks() {
  return Axios({
    url: '/book/new',
    method: 'get',
  })
}

export function getBook1(i: string) {
  return Axios({
    url: `/book${i}`,
    method: 'get',
  })
}
export function getBook2() {
  return Axios({
    url: '/search/',
    method: 'get',
    params: 'wd',
  })
}
export function getBook(id: number) {
  return Axios({
    url: `/book/${id}`,
    method: 'get',
  })
}
export function getCommit(id: number) {
  return Axios({
    url: `/book/${id}/comment`,
    method: 'get',
  })
}
export function registerApi(obj: {
  username: string
  password: string
  mobile: string
}) {
  return Axios({
    url: '/user/register',
    method: 'post',
    data: {
      username: obj.username,
      password: obj.password,
      mobile: obj.mobile,
    },
  })
}
export function loginApi(obj: { username: string; password: string }) {
  return Axios({
    url: '/user/register',
    method: 'post',
    data: {
      username: obj.username,
      password: obj.password,
    },
  })
}
